package com.client.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JPanel;

@SuppressWarnings("serial")
public class TextComponent extends JPanel {
	String	text;
	Font	textFont;
	Color	color;
	int		width;
	int		height;

	public TextComponent(String text, Font font, Color color, int width, int height)
	{
		// setBackground(Color.WHITE);
		setOpaque(false);
		// setBorder(BorderFactory.createLineBorder(Color.black));
		this.textFont = font;
		this.text = text;
		this.color = color;
		this.width = width;
		this.height = height;
	}

	public void paintComponent(Graphics g)
	{
		Graphics2D g2 = (Graphics2D) g;

		// Draw Text
		g2.setFont(textFont);
		g2.setColor(color);
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		g2.drawString(text, 10, 50);
	}

	public Dimension getPreferredSize()
	{
		return new Dimension(width, height);
	}
}
